Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Fix windows panic on os.Rename when target file exists #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

thomasf
Copy link

@thomasf thomasf commented Mar 9, 2015

Try to delete it first, but only on windows since it isn't atomic at all.

@facebook-github-bot
Copy link

Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at cla@fb.com. Thanks!

@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@daaku
Copy link
Contributor

daaku commented Mar 10, 2015

This means it's no longer atomic :( Looks like https://msdn.microsoft.com/en-us/library/windows/desktop/aa365240(v=vs.85).aspx is one way to make this atomic on windows. I don't have a windows machine handy, but I think we should attempt to build an atomic version of this before we give up and go the os.Remove route.

@thomasf
Copy link
Author

thomasf commented Mar 10, 2015

Yeah, I agree about it not being very good.. I should probably just have opened an issue instead..

Related golang issue planned for go1.5: golang/go#8914

And here is an implementation: lvarvel/cacheddownloader@505a1fd'

I'm not really in a hurry getting this resolved right now.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants